.. _ecmIxMot_ArcAng_R_Start: ecmIxMot_ArcAng_R_Start ============================ ---------------------------- .. Hint:: :ref:`ECAT_Appendix_00` 사용 가능 SYNOPSIS -------- .. code-block:: none t_cmdidx ecmIxMot_ArcAng_R_Start(_FF)( t_i32 NetID, t_i32 MapIndex, t_f64 XCentOffset, t_f64 YCentOffset, t_f64 EndAngle, t_i32 *ErrCode ) DESCRIPTION ----------- - 중심좌표와 원호의 각도를 매개변수로 하여 원호보간 이송을 수행합니다. 이때 중심좌표는 상대 좌표로 포현됩니다. - ecmIxMot_ArcAng_R_Start(_FF) 는 모션을 시작시킨 후에 바로 반환됩니다. PARAMETER --------- - NetID : Network 번호 - MapIndex : 맵 번호 - XCentOffset : 현재 위치(시작위치)로부터 원의 중심까지 X축 상대좌표값. 거리의 단위는 논리적 거리를 적용합니다. - YCentOffset : 현재 위치(시작위치)로부터 원의 중심까지 Y축 상대좌표값. 거리의 단위는 논리적 거리를 적용합니다. - EndAngle : 원호보간 이동을 완료할 목표지점의 현재 위치에 대한 각도값을 Degree값으로 지정합니다. 각도의 부호가 (+) 이면 반시계방향, (-) 이면 시계방향으로의 이동을 의미합니다. - ErrCode : 이 매개 변수를 통하여 현재의 에러 코드를 반환합니다. 단, 이 매개 변수에 NULL을 전달하면 에러 코드를 반환하지 않습니다. RETURN VALUE ------------ - 이 리턴값은 함수의 cmdidx가 반환됩니다. EXAMPLE ````````````` .. image:: ecmIxMot_ArcAng_R_Start_00.jpg .. code-block:: cpp :linenos: //본 예제는 아래 그림과 같이 직선보간 이동과 원호보간 이동을 조합하는 Coordinated Motion을 수행하는 예제입니다. //P1점으로부터 출발하여 P8점을 거쳐 다시 P1으로 복귀하는 작업입니다. #include "ComiEcatSdk_Api.h" #define AXISX 0 #define AXISY 1 #define MAP0 0 #define MAP1 1 t_32 Error_Num = 0;//함수 별 에러 코드 저장 변수 /*************************************************************** * OnProgramInitial : 이 함수는 가상의 함수로서 프로그램 초기화 루틴이 * 적용되는 부분을 의미합니다. ***************************************************************/ void OnProgramInitial() { TEcDevInfo Device_Info; //디바이스 정보 저장 할 구조체 t_i32 Device_Num = 0; t_success nIsLoaded = ecDll_Load (); if(!ecGn_LoadDevices(&Error_Num)){ //장치 로드 //로드 실패시 예외 처리 } if(!ecGn_GetDevInfo(Device_Num,&Device_Info, &Error_Num)){ //디바이스 정보 로드 실패 시 예외 처리 } ecNet_SetAlState(Device_Info.NetIdx, ecAL_STATE_OP, &Error_Num); //ALState OP모드로 전환 ecmSxCtl_SetSvon(Device_Info.NetIdx, AXISX, &Error_Num); ecmSxCtl_SetSvon(Device_Info.NetIdx, AXISY, &Error_Num); } /*************************************************************** * OnSetSpeed : 이 함수는 속도설정의 변경이 필요할 때 * 호출되는 가상의 함수 입니다. ***************************************************************/ void OnSetSpeed() { ecmIxCfg_MapAxes (Device_Info.NetIdx , MAP0, AXISX | AXISY, 0, ecmIX_MODE_LINEAR , &Error_Num); ecmIxCfg_MapAxes (Device_Info.NetIdx , MAP0, AXISX | AXISY, 0, ecmIX_MODE_LINEAR , &Error_Num); ecmIxCfg_SetSpeedPatt( Device_Info.NetIdx , MAP0, 0, 0, 0, 40000, 10000, 10000, &Error_Num); ecmIxCfg_SetSpeedPatt( Device_Info.NetIdx , MAP1, 0, 0, 0, 40000, 10000, 10000, &Error_Num); //보간 그룹에 축을 설정하고 //MAP0은 직선 보간 모드 MAP1은 원호 보간 모드 로 설정 } /************************************************************** * OnDoMotion() : 작업명령시에 호출되는 가상의 함수 **************************************************************/ void OnDoMotion() { double fDistList[2]; // Move from P1 to P2 fDistList[0]=1000; fDistList[1]=0; ecmIxMot_LineStart (Device_Info.NetIdx, MAP0, fDistList, &Error_Num); // Move from P2 to P3 ecmIxMot_ArcAng_R_Start (Device_Info.NetIdx, MAP1, 0, 500, 90, &Error_Num); // Move from P3 to P4 fDistList[0]=0; fDistList[1]=1000; ecmIxMot_LineStart (Device_Info.NetIdx, MAP0, fDistList, &Error_Num); // Move from P4 to P5 ecmIxMot_ArcAng_R_Start (Device_Info.NetIdx, MAP1, -500, 0, 90, &Error_Num); // Move from P5 to P6 fDistList[0]=-1000; fDistList[1]=0; ecmIxMot_LineStart (Device_Info.NetIdx, MAP0, fDistList, &Error_Num); // Move from P6 to P7 ecmIxMot_ArcAng_R_Start Device_Info.NetIdx, MAP1, 0, -500, 90, &Error_Num); // Move from P7 to P8 fDistList[0]=0; fDistList[1]=-1000; ecmIxMot_LineStart (Device_Info.NetIdx, MAP0, fDistList, &Error_Num); // Move from P8 to P1 ecmIxMot_ArcAng_R_Start (Device_Info.NetIdx, MAP1, 500, 0, 90, &Error_Num); }